(function() {
    angular.module('app').component('mobileComponent', {
        templateUrl: 'app/components/mobile.component/mobile.component.html',
        controller: mobileComponent,
        controllerAs: 'vm'
    });

    mobileComponent.$inject = ['$rootScope', '$scope','$timeout'];

    function mobileComponent($rootScope, $scope,$timeout) {
    	var vm = this;

    	vm.prod = {};

        $('#mobile-modal-box').modal();

        var clearFun = $rootScope.$on('Mobile_Component_EV', function(e, prod) {
            vm.prod = null;
            console.log('-------------------Mobile_Component_EV--------------');
            console.log(prod);
            $timeout(function(){
                vm.prod = prod;
            },10);
            
            $('#mobile-modal-box').modal('open');
        });

        $scope.$on('$destroy', function() {
            clearFun();
        });
    }
})();
